(in-package :iorek)

(defun exit ()
  (throw 'stop nil))

(record-definition *symbol-lang-exit* 'exit :kind :lisp-function)

(defun start-repl (&key
                   (input-stream *standard-input*)
                   (output-stream *standard-output*)
                   (*namespace* *symbol-iorek*))
  (catch 'stop
    (loop
       (print-object *namespace* output-stream)
       (princ "> " output-stream)
       (let ((expr (read-expression input-stream)))
         (print-object (eval (translate-form expr)) output-stream)
         (terpri output-stream)))))
